/*
 * This source code is part of TWaver 4.0
 *
 * Serva Software PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 * Copyright 2002 - 2011 Serva Software. All rights reserved.
 */

package demo.table.person;

import twaver.Node;

public class Person extends Node{

	public Person(){
	}
	
	public Person(Object id){
		super(id);
	}
	
	// java bean property
	public String firstName;
	private String lastName;
	private int age;
	
	public String getFirstName() {
		return firstName;
	}
	public void setFirstName(String firstName) {
		if(firstName == null){
			return;
		}
		String oldValue = this.firstName;
		this.firstName = firstName;
		this.setToolTipText(firstName);
		this.firePropertyChange("firstName", oldValue, this.firstName);
		this.firePropertyChange("fullName", oldValue + " " + this.lastName, this.getFullName());
	}
	public String getLastName() {
		return lastName;
	}
	public void setLastName(String lastName) {
		if(lastName == null){
			return;
		}
		String oldValue = this.lastName;
		this.lastName = lastName;
		this.firePropertyChange("lastName", oldValue, this.lastName);
		this.firePropertyChange("fullName", firstName + " " + oldValue, this.getFullName());
	}
	public String getFullName(){
		return this.getFirstName() + " " + this.getLastName();
	}
	public int getAge() {
		return age;
	}
	public void setAge(int age) {
		if(age >= 0 && age < 100){
			int oldValue = this.age;
			this.age = age;
			this.firePropertyChange("age", oldValue, this.age);	
		}
	}

}